﻿using System;
using System.Data.Entity;
using OpenRiaServices.Issue92.Web.Migrations;
using OpenRiaServices.Issue92.Web.Models;

namespace OpenRiaServices.Issue92.Web
{
    public class Global : System.Web.HttpApplication
    {

        protected void Application_Start(object sender, EventArgs e)
        {
            Database.SetInitializer(new MigrateDatabaseToLatestVersion<Issue92Context, Configuration>());

            // Force to apply migrations on application start
            using (var context = new Issue92Context())
            {
                context.Database.Initialize(true);
            }
        }

        protected void Session_Start(object sender, EventArgs e)
        {

        }

        protected void Application_BeginRequest(object sender, EventArgs e)
        {

        }

        protected void Application_AuthenticateRequest(object sender, EventArgs e)
        {

        }

        protected void Application_Error(object sender, EventArgs e)
        {

        }

        protected void Session_End(object sender, EventArgs e)
        {

        }

        protected void Application_End(object sender, EventArgs e)
        {

        }
    }
}